/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package warmachineroster.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;

import warmachineroster.RosterElement;
import warmachineroster.WarjackRosterElement;
import warmachineroster.WarmachineRosterPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Warjack Roster Element</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link warmachineroster.impl.WarjackRosterElementImpl#getMainUnit <em>Main Unit</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class WarjackRosterElementImpl extends RosterElementImpl implements WarjackRosterElement {
	/**
	 * The cached value of the '{@link #getMainUnit() <em>Main Unit</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMainUnit()
	 * @generated
	 * @ordered
	 */
	protected RosterElement mainUnit;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected WarjackRosterElementImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return WarmachineRosterPackage.Literals.WARJACK_ROSTER_ELEMENT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RosterElement getMainUnit() {
		if (mainUnit != null && mainUnit.eIsProxy()) {
			InternalEObject oldMainUnit = (InternalEObject)mainUnit;
			mainUnit = (RosterElement)eResolveProxy(oldMainUnit);
			if (mainUnit != oldMainUnit) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, WarmachineRosterPackage.WARJACK_ROSTER_ELEMENT__MAIN_UNIT, oldMainUnit, mainUnit));
			}
		}
		return mainUnit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RosterElement basicGetMainUnit() {
		return mainUnit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMainUnit(RosterElement newMainUnit) {
		RosterElement oldMainUnit = mainUnit;
		mainUnit = newMainUnit;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WarmachineRosterPackage.WARJACK_ROSTER_ELEMENT__MAIN_UNIT, oldMainUnit, mainUnit));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case WarmachineRosterPackage.WARJACK_ROSTER_ELEMENT__MAIN_UNIT:
				if (resolve) return getMainUnit();
				return basicGetMainUnit();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case WarmachineRosterPackage.WARJACK_ROSTER_ELEMENT__MAIN_UNIT:
				setMainUnit((RosterElement)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case WarmachineRosterPackage.WARJACK_ROSTER_ELEMENT__MAIN_UNIT:
				setMainUnit((RosterElement)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case WarmachineRosterPackage.WARJACK_ROSTER_ELEMENT__MAIN_UNIT:
				return mainUnit != null;
		}
		return super.eIsSet(featureID);
	}

} //WarjackRosterElementImpl
